<template>
  <div>
    <div style="width: 100%;text-align: right">
      <el-button size="mini" type="primary" @click="addProduct">
        <i class="el-icon-plus"/>
        关联产品
      </el-button>
    </div>
    <el-table :data="productData" style="width: 100%;margin-top: 8px" v-loading="loading">
      <el-table-column show-overflow-tooltip fixed align="center" prop="productName" label="产品名称" min-width="155"/>
      <el-table-column show-overflow-tooltip align="center" prop="categoryName" label="产品类别" min-width="115">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_crm_product_category" :value="scope.row.categoryId"/>
        </template>
      </el-table-column>
      <el-table-column show-overflow-tooltip align="center" prop="unit" label="单位" min-width="105">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_crm_product_unit" :value="scope.row.unit"/>
        </template>
      </el-table-column>
      <el-table-column show-overflow-tooltip align="center" prop="price" label="标准价格" min-width="115"/>
      <el-table-column show-overflow-tooltip align="center" prop="salesPrice" label="售价" min-width="135"/>
      <el-table-column show-overflow-tooltip align="center" prop="num" label="数量" min-width="95"/>
      <el-table-column show-overflow-tooltip align="center" prop="discount" label="折扣（%）" min-width="95"/>
      <el-table-column show-overflow-tooltip align="center" prop="subtotal" label="合计" min-width="135"/>
      <el-table-column show-overflow-tooltip align="center" label="操作" min-width="135">
        <template slot-scope="scope">
          <el-button type="text" @click="remove(scope.row.id)">移出</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: 'ProductDrawerTable',
  components: {},
  dicts: ['sys_crm_category_name', 'sys_crm_product_unit', 'sys_crm_product_category'],
  props: {
    productData: {
      type: Array
    },
    loading: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {}
  },
  // 在实例创建完成后被立即调用
  created() {

  },
  // 实例被挂在后调用
  mounted() {

  },
  // 方法
  methods: {
    remove(id) {

    },
    addProduct() {

    }
  }
}
</script>

<style scoped>

</style>
